var windowWidth = document.documentElement.clientWidth;

var windowHeight = document.documentElement.clientHeight;

//浏览器中心点的横坐标
var centerX = windowWidth/2;
//浏览器中心点的纵坐标
var centerY = windowHeight/2;

$("#xc div").each(function(){
    var x = Math.random()*1000-500;
    x = Math.floor(x);
    x  = centerX + x -50;
    var y = Math.random()*400-200;
    y = Math.floor(y);
    y = centerY + y - 50;

    $(this).css("left",x+"px");
    $(this).css("top",y+"px");

    //随机成成一个角度
    //-30~-10 10~30
    var angle = Math.random()*40;
    angle = angle>20?angle+20:angle;
    angle-=30;
    angle = Math.floor(angle);
    //设置旋转
    $(this).css("transform","rotate("+angle+"deg)");
});

$("#xc div a").fancybox();